<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
    <body>
        
        
        <ui:composition template="../plantilla/plantilla.xhtml">
            <ui:define name="content">
                <h:panelGrid columns="1" style="vertical-align: top">
                    <h:panelGrid columns="3">
                        <h:outputLabel for="ubiCompra" value="Ubicación: " style="float: left"/>
                        <p:selectOneMenu id="ubiCompra" value="#{compraCercaBean.depto}">
                            <f:selectItem itemLabel="SAN SALVADOR" itemValue="SAN SALVADOR" />
                            <f:selectItem itemLabel="AHUACHAPAN" itemValue="AHUACHAPAN" />
                            <f:selectItem itemLabel="SANTA ANA" itemValue="SANTA ANA" />
                            <f:selectItem itemLabel="SONSONATE" itemValue="SONSONATE" />
                            <f:selectItem itemLabel="CHALATENANGO" itemValue="CHALATENANGO" />
                            <f:selectItem itemLabel="CABAÑAS" itemValue="CABAÑAS" />                                
                            <f:selectItem itemLabel="LA PAZ" itemValue="LA PAZ" />
                            <f:selectItem itemLabel="SAN VICENTE" itemValue="SAN VICENTE" />
                            <f:selectItem itemLabel="USULUTAN" itemValue="USULUTAN" />
                            <f:selectItem itemLabel="SAN MIGUEL" itemValue="SAN MIGUEL" />
                            <f:selectItem itemLabel="MORAZAN" itemValue="MORAZAN" />
                            <f:selectItem itemLabel="LA UNION" itemValue="LA UNION" />
                        </p:selectOneMenu>
                        <p:commandButton value="Ver terrenos" action="#{compraCercaBean.updateData}" update=":form:listaInterTable"/>
                    </h:panelGrid>
                    
                    <p:dataTable var="row" emptyMessage="No se encontraron registros"  
                        value="#{compraCercaBean.images}" paginatorPosition="bottom"
                        rowKey="#{row.idcasater}" paginator="true" rows="3"  style="width: 100%; float: left;" 
                        id="listaInterTable">
                        <p:column  >
                            
                                <h:panelGrid columns="1" >
                                        <p:graphicImage value="#{compraCercaBean.streamImagen}" width="425px" height="300px"  >
                                            <f:param name="nameImage" value="#{row.nombrefoto}"/>    
                                            <f:param name="direc" value="#{row.direccion}"/>
                                        </p:graphicImage>
                                </h:panelGrid>
                        </p:column>
                        <p:column >
                            <h:panelGrid columns="1">
                                <p:commandButton id="mapBtn" icon="ui-icon-image" title="Mostrar mapa" action="#{compraCercaBean.mostrarMapa}" update=":form:dialogShow" >
                                    <f:param name="direc" value="#{row.direccion}"/>
                                </p:commandButton>
                                <p:commandButton id="resBtn" icon="ui-icon-home" title="Mostrar plano" action="#{compraCercaBean.mostrarPlot}" update=":form:dialogPlotShow" >
                                    <f:setPropertyActionListener target="#{compraCercaBean.nombrePlot}" value="#{row.nombreplano}"/>
                                </p:commandButton>    
                            </h:panelGrid>
                        </p:column>
                        
                        
                    </p:dataTable>
                    
                </h:panelGrid>
                <p:dialog id="dialogShow" widgetVar="dialogShow" modal="true" appendToBody="true" width="650" height="450" >
                    <h:panelGrid columns="1" style="width: 600px;">
                        
                        <p:gmap id="mapa" widgetVar="mapa" center="13.706881, -89.21373179999999" zoom="13" type="HYBRID"
                                style="width:600px;height:400px" model="#{compraCercaBean.simpleMapModel}" />
                        
                    </h:panelGrid>
                    
                </p:dialog>
                
                <p:dialog id="dialogPlotShow" widgetVar="dialogPlotShow" modal="true" appendToBody="true" width="650" height="450" >
                    <p:panel>
                        <h:panelGrid columns="1" style="width: 600px;">

                            <p:graphicImage id="plotImagen" value="#{compraCercaBean.streamImagenPlot}" width="425px" height="300px"  >
                                <f:param name="plotImage" value="#{compraCercaBean.nombrePlot}"/>
                            </p:graphicImage>
                        </h:panelGrid>
                    </p:panel>
                </p:dialog>

            </ui:define>
        </ui:composition>
    </body>
</html>
